# Maintainer: David Runge <dvzrv@archlinux.org>
# Contributor: Ray Rashif <schiv@archlinux.org>
# Contributor: Tobias Kieslich <tobias@archlinux.org>

pkgname=qjackctl
pkgver=0.9.12
pkgrel=1
pkgdesc="A Qt front-end for the JACK low-latency audio server"
arch=(loong64 x86_64)
url="https://qjackctl.sourceforge.io"
license=(GPL-2.0-or-later)
groups=(pro-audio)
depends=(
  gcc-libs
  glibc
  hicolor-icon-theme
  qt6-base
  qt6-svg
)
makedepends=(
  alsa-lib
  cmake
  jack2
  jack2-dbus
  qt6-tools
  portaudio
)
optdepends=(
  'jack2-dbus: for JACK dbus support'
  'qt6-wayland: for native wayland support'
)
source=(https://downloads.sourceforge.net/$pkgname/$pkgname-$pkgver.tar.gz)
sha512sums=('56cd8befa89ed8b473b4f287a11308c8ac76173489a451aa631696995475d428414ebd87b591b43b58af9813c0b039dc968a047dd6182a0f4efc650095a047dd')
b2sums=('eb16ec14aac95559ccafbbf6cc4f40ded8ad3cebad25bf0cf6f8b4ac36e9683bf32d52010535dcc9c54066366ee7e8a797a5fe29d7c5ee9057ac0399fa3c7b30')

build() {
  local cmake_options=(
    -B build
    -D CMAKE_BUILD_TYPE=None
    -D CMAKE_INSTALL_PREFIX=/usr
    -D CONFIG_QT6=ON
    -S $pkgname-$pkgver
    -W no-dev
  )

  cmake "${cmake_options[@]}"
  cmake --build build --verbose
}

package() {
  depends+=(
    alsa-lib libasound.so
    jack libjack.so
    portaudio libportaudio.so
  )

  DESTDIR="$pkgdir" cmake --install build
  install -vDm 644 $pkgname-$pkgver/{ChangeLog,README,TRANSLATORS} -t "$pkgdir/usr/share/doc/$pkgname"
}
